package edu.cth.scrabbit.server.core;

import java.util.List;

import edu.cth.scrabbit.server.core.network.PlayerThread;
import edu.cth.scrabbit.shared.GameLetter;
import edu.cth.scrabbit.shared.network.Statement;

/**
 * This interface describes all information that are important to describe the
 * server's part of the application and it's interaction with the clients.
 * 
 * @author Marcus Harryson, Anders Jonsson
 * 
 */
public interface IServerModel {

	// Attempt to add a player to the server
	public abstract void addPlayer(ServerPlayer player);

	public abstract boolean wasPlayerAdded();

	// Have the network subsystem start listening for connections:
	public abstract void startListening();

	// Called right after a connection has been established; a client is sending
	// a player's name information to this server:
	public abstract Statement playerConnected(ServerPlayer player,
			String nickname);

	// Get the server player associated with a certain thread (used mainly by
	// the network subsystem):
	public abstract ServerPlayer getServerPlayer(PlayerThread thread);

	// Advance the game to the next player in order:
	public abstract void nextPlayer();

	// A player has attempted to "pass".
	public abstract Statement pass(ServerPlayer player);

	public abstract Statement startGame(ServerPlayer player);

	public abstract void endGame();

	// A player has attempted to perform the "swap" action:
	public abstract Statement swap(ServerPlayer player);

	// Get a statement containing the current game state, used extensively
	// within this class
	public abstract Statement getGameStateStatement(ServerPlayer player);

	// A player has attempted to perform the "play" action:
	public abstract Statement play(ServerPlayer player, List<GameLetter> list);

}